package code;

public class Book {
	private String name;
	private Author[] authors;
	private double price;
	int qty=0;
	public Book(String name, Author[] authors, double price){
		this.name=name;
		this.authors=authors;
		this.price=price;
	}
	public Book(String name, Author[] authors, double price, int qty){
		this.name=name;
		this.authors=authors;
		this.price=price;
		this.qty=qty;
	}
	public String getName(){
		return name;
	}
	public Author[] getAuthors(){
		return authors;
	}
	public double getPrice(){
		return price;
	}
	public void setPrice(double price){
		this.price=price;
	}
	public int getQty(){
		return qty;
	}
	public void setQty(int qty){
		this.qty=qty;
	}
	public String toString(){
		String str2="Book[name="+name+",author={Author";
		for(Author a: authors){
			str2+=a.toString();
			if(!a.equals(authors[authors.length-1])){
				str2+=",";
			}
		}
		str2+="},price="+price+",qty="+qty+"]";
		return str2;
	}
	public String  getAuthorNames(){
		String str="";
		for(int i=0; i<authors.length; i++){
			str+=authors[i].getName()+", ";
		}
		return str;
	}
	

	}


